﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:sys="clr-namespace:System;assembly=mscorlib"
                    xmlns:Converter="clr-namespace:Wpf.Core.Converter;assembly=Wpf.Core">

    <Converter:AddMarginConverter x:Key="addMarginConverter" />
    <Converter:WindowCenteredPositionConverter x:Key="windowCenteredPositionConverter" />

    <sys:Double x:Key="ContentHeight">280.0</sys:Double>
    <sys:Double x:Key="ContentWidth">400.0</sys:Double>
    
    <BitmapImage x:Key="ApplicationIcon" UriSource="/Image/AppIcon.ico" />

    <Style x:Key="ShellWindowStyle" TargetType="Window">
        <!--<Setter Property="Title" Value="Application Title" />-->
        <Setter Property="Icon" Value="{StaticResource ApplicationIcon}" />
        <Setter Property="ShowInTaskbar" Value="True" />
        <Setter Property="WindowState" Value="Maximized" />
        <Setter Property="Topmost" Value="False" />
        <Setter Property="ResizeMode" Value="CanResize" />
        <Setter Property="WindowStyle" Value="SingleBorderWindow" />
    </Style>

    <Style x:Key="PopupWindowRegionStyle" TargetType="Window">
        <Setter Property="Background" Value="#FFF3F5F4" />
        <Setter Property="Margin" Value="0" />
        <Setter Property="Padding" Value="0" />
        <Setter Property="ShowInTaskbar" Value="false" />
        <Setter Property="ResizeMode" Value="NoResize" />
        <Setter Property="WindowState" Value="Normal" />
        <Setter>
            <Setter.Property>Top</Setter.Property>
            <Setter.Value>
                <MultiBinding Converter="{StaticResource windowCenteredPositionConverter}">
                    <Binding Path="Height" Source="{x:Static SystemParameters.WorkArea}"/>
                    <Binding Path="Top" Source="{x:Static SystemParameters.WorkArea}"/>
                    <Binding Path="Content.Height" RelativeSource="{RelativeSource Self}"/>
                </MultiBinding>
            </Setter.Value>
        </Setter>
        <Setter>
            <Setter.Property>Left</Setter.Property>
            <Setter.Value>
                <MultiBinding Converter="{StaticResource windowCenteredPositionConverter}">
                    <Binding Path="Width" Source="{x:Static SystemParameters.WorkArea}"/>
                    <Binding Path="Left" Source="{x:Static SystemParameters.WorkArea}"/>
                    <Binding Path="Content.Width" RelativeSource="{RelativeSource Self}"/>
                </MultiBinding>
            </Setter.Value>
        </Setter>
        <Setter Property="Width" Value="{Binding Path=Content.Width, RelativeSource={RelativeSource Self}, Converter={StaticResource ResourceKey=addMarginConverter}, ConverterParameter=5}" />
        <Setter Property="Height" Value="{Binding Path=Content.Height, RelativeSource={RelativeSource Self}, Converter={StaticResource ResourceKey=addMarginConverter}, ConverterParameter=30}" />
        <!--<Setter Property="Title" Value="{Binding Path=Content.DataContext.WindowTitle, RelativeSource={RelativeSource Self}, FallbackValue=AppTitle}" />-->
    </Style>
    
</ResourceDictionary>